﻿using System;
using BusinessLogic.BusinessEntity.Entities;
using BusinessLogic.Connectivity.Entities;
using BusinessLogic.Managers.Security;
using BusinessLogic.Mappers;
using DataAccess.Services;

namespace BusinessLogic.Managers
{
	[GrantAccess(Role.BankEmployee)]
	[GrantAccess(Role.Client)]
	public class DocumentReceiver
	{
		public static void ReceiveDocument(DocumentEnvelope envelope)
		{
			using (IServiceManager serviceManager = new ServiceManager())
			{
				envelope.Status = DocumentEnvelopeStatus.Received;
				envelope.SentDate = DateTime.UtcNow;
				MapperFactory.GetDocumentEnvelopeMapper(serviceManager).Insert(envelope);
			}
		}
	}
}